package Beans

type TemplateType int32

const (
	PdfTemplate TemplateType = iota + 1
	HTmlTemplate
)

// 获取页面
type CreateTemplate struct {
	DocTemplateName string `json:"docTemplateName,omitempty"`
	DocTemplateType int32  `json:"docTemplateType,omitempty"`
	FileId          string `json:"fileId,omitempty"`
	RedirectUrl     string `json:"redirectUrl,omitempty"`
}

// 上传文件到e签宝req
type UploadFileReq struct {
	ContentMd5    string `json:"contentMd5,omitempty"`
	ContentType   string `json:"contentType,omitempty"`
	FileName      string `json:"fileName,omitempty"`
	FileSize      int64  `json:"fileSize,omitempty"`
	ConvertToPDF  bool   `json:"convertToPDF,omitempty"`
	ConvertToHTML bool   `json:"convertToHTML,omitempty"`
}

type BaseRsp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}
type UploadFileRsp struct {
	BaseRsp
	Data struct {
		FileId               string `json:"fileId"`
		FileUploadUrl        string `json:"fileUploadUrl"`
		TemplateId           string `json:"templateId"`
		FileName             string `json:"fileName"`
		DocTemplateCreateUrl string `json:"docTemplateCreateUrl"`
	} `json:"data"`
}

type RealUploadFileRsp struct {
	ErrCode int    `json:"errCode"`
	Msg     string `json:"msg"`
}

//创建个人账号json信息配置
type CreatePersonByThirdPartyUserIdInfo struct {
	ThirdPartyUserId string `json:"thirdPartyUserId,omitempty"`
	Name             string `json:"name,omitempty"`
	IdType           string `json:"idType,omitempty"`
	IdNumber         string `json:"idNumber,omitempty"`
	Mobile           string `json:"mobile,omitempty"`
	Email            string `json:"email,omitempty"`
}

//CheckFilStatusRsp 检测文件状态返回结构体
type CheckFilStatusRsp struct {
	BaseRsp
	Data struct {
		FileId             string `json:"fileId"`
		FileName           string `json:"fileName"`
		FileSize           string `json:"fileSize"`
		FileStatus         int    `json:"fileStatus"`
		FileDownloadUrl    string `json:"fileDownloadUrl"`
		FileTotalPageCount int    `json:"fileTotalPageCount"`
	} `json:"data"`
}

type GetTemplateDetailRsp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		DocTemplateID   string `json:"docTemplateId"`
		DocTemplateName string `json:"docTemplateName"`
		CreateTime      int64  `json:"createTime"`
		UpdateTime      int64  `json:"updateTime"`
		FileDownloadURL string `json:"fileDownloadUrl"`
		Components      []struct {
			ComponentID       string `json:"componentId"`
			ComponentKey      string `json:"componentKey"`
			ComponentName     string `json:"componentName"`
			ComponentType     int    `json:"componentType"`
			ComponentPosition struct {
				ComponentPositionX float64 `json:"componentPositionX"`
				ComponentPositionY float64 `json:"componentPositionY"`
				ComponentPageNum   int     `json:"componentPageNum"`
			} `json:"componentPosition"`
			ComponentSpecialAttribute struct {
				DateFormat interface{} `json:"dateFormat"`
				ImageType  interface{} `json:"imageType"`
				Options    interface{} `json:"options"`
			} `json:"componentSpecialAttribute"`
			ComponentSize struct {
				ComponentWidth  int `json:"componentWidth"`
				ComponentHeight int `json:"componentHeight"`
			} `json:"componentSize"`
			RemarkSignField interface{} `json:"remarkSignField"`
			NormalSignField struct {
				ShowSignDate   int         `json:"showSignDate"`
				DateFormat     interface{} `json:"dateFormat"`
				SignFieldStyle int         `json:"signFieldStyle"`
			} `json:"normalSignField"`
		} `json:"components"`
	} `json:"data"`
}

//创建企业账号json信息配置
type CreateOrganizationsByThirdPartyUserIdInfo struct {
	ThirdPartyUserId string `json:"thirdPartyUserId,omitempty"`
	Creator          string `json:"creator,omitempty"`
	Name             string `json:"name,omitempty"`
	IdType           string `json:"idType,omitempty"`
	IdNumber         string `json:"idNumber,omitempty"`
	OrgLegalIdNumber string `json:"orgLegalIdNumber,omitempty"`
	OrgLegalName     string `json:"orgLegalName,omitempty"`
}

type GetCreateTemplateUrlRsp struct {
	BaseRsp
	Data struct {
		DocTemplateId        string `json:"docTemplateId"`
		DocTemplateCreateUrl string `json:"docTemplateCreateUrl"`
		DocTemplateName      string `json:"docTemplateName"`
	} `json:"data"`
}

type FillTemplateRequest struct {
	DocTemplateID string       `json:"docTemplateId" binding:"required"`
	FileName      string       `json:"fileName" binding:"required"`
	Components    []Components `json:"components"`
	Id            int          `json:"id" binding:"required"` // 订单id
}
type Components struct {
	ComponentID    string `json:"componentId"`
	ComponentKey   string `json:"componentKey"`
	ComponentValue string `json:"componentValue"`
}

type FillTemplateRsp struct {
	BaseRsp
	Data CreateTemplateData `json:"data"`
}
type CreateTemplateData struct {
	FileID          string `json:"fileId"`
	FileDownloadURL string `json:"fileDownloadUrl"`
}

type PsnAuthUrlRsp struct {
	BaseRsp
	Data Data `json:"data"`
}
type Data struct {
	AuthFlowID   string `json:"authFlowId"`
	AuthURL      string `json:"authUrl"`
	AuthShortURL string `json:"authShortUrl"`
}

type EsignCreateByFileRsp struct {
	BaseRsp
	Data struct {
		SignFlowId string `json:"signFlowId"`
	} `json:"data"`
}
type ESignSignUrlRsp struct {
	BaseRsp
	Data ESignSignUrlData `json:"data"`
}
type ESignSignUrlData struct {
	URL      string `json:"url"`
	ShortURL string `json:"shortUrl"`
}

type FileDownloadUrlRsp struct {
	Code    int                 `json:"code"`
	Message string              `json:"message"`
	Data    FileDownloadUrlData `json:"data"`
}
type Files struct {
	FileID      string `json:"fileId"`
	FileName    string `json:"fileName"`
	DownloadURL string `json:"downloadUrl"`
}
type Attachments struct {
	FileID      string `json:"fileId"`
	FileName    string `json:"fileName"`
	DownloadURL string `json:"downloadUrl"`
}
type FileDownloadUrlData struct {
	Files       []Files       `json:"files"`
	Attachments []Attachments `json:"attachments"`
}

type IdentityInfoRsp struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	Data    IdentityInfoData `json:"data"`
}
type PsnAccount struct {
	AccountMobile string      `json:"accountMobile"`
	AccountEmail  interface{} `json:"accountEmail"`
}
type PsnInfo struct {
	PsnName        string      `json:"psnName"`
	PsnNationality interface{} `json:"psnNationality"`
	PsnIDCardNum   string      `json:"psnIDCardNum"`
	PsnIDCardType  string      `json:"psnIDCardType"`
	BankCardNum    interface{} `json:"bankCardNum"`
	PsnMobile      string      `json:"psnMobile"`
}
type IdentityInfoData struct {
	AuthorizeUserInfo bool       `json:"authorizeUserInfo"`
	RealnameStatus    int        `json:"realnameStatus"`
	PsnID             string     `json:"psnId"`
	PsnAccount        PsnAccount `json:"psnAccount"`
	PsnInfo           PsnInfo    `json:"psnInfo"`
}

type SignDetailRsp struct {
	BaseRsp
	Data struct {
		SignFlowInitiator struct {
			PsnInitiator interface{} `json:"psnInitiator"`
			OrgInitiator struct {
				OrgID      string      `json:"orgId"`
				Transactor interface{} `json:"transactor"`
			} `json:"orgInitiator"`
		} `json:"signFlowInitiator"`
		SignFlowConfig struct {
			SignFlowTitle      string `json:"signFlowTitle"`
			AutoFinish         bool   `json:"autoFinish"`
			SignFlowExpireTime int64  `json:"signFlowExpireTime"`
			NotifyURL          string `json:"notifyUrl"`
			ChargeConfig       struct {
				ChargeMode  int         `json:"chargeMode"`
				OrderType   interface{} `json:"orderType"`
				BarrierCode interface{} `json:"barrierCode"`
			} `json:"chargeConfig"`
			NoticeConfig struct {
				NoticeTypes string `json:"noticeTypes"`
			} `json:"noticeConfig"`
			SignConfig struct {
				AvailableSignClientTypes string `json:"availableSignClientTypes"`
				ShowBatchDropSealButton  bool   `json:"showBatchDropSealButton"`
			} `json:"signConfig"`
			AuthConfig struct {
				PsnAvailableAuthModes []string    `json:"psnAvailableAuthModes"`
				OrgAvailableAuthModes interface{} `json:"orgAvailableAuthModes"`
				WillingnessAuthModes  []string    `json:"willingnessAuthModes"`
				AudioVideoTemplateID  interface{} `json:"audioVideoTemplateId"`
			} `json:"authConfig"`
		} `json:"signFlowConfig"`
		SignFlowStatus      int         `json:"signFlowStatus"`
		RescissionStatus    int         `json:"rescissionStatus"`
		SignFlowCreateTime  int64       `json:"signFlowCreateTime"`
		SignFlowStartTime   int64       `json:"signFlowStartTime"`
		SignFlowFinishTime  interface{} `json:"signFlowFinishTime"`
		SignFlowDescription string      `json:"signFlowDescription"`
		Docs                []struct {
			FileID      string `json:"fileId"`
			FileName    string `json:"fileName"`
			FileEditPwd string `json:"fileEditPwd"`
		} `json:"docs"`
		Attachments []struct {
			FileID   string `json:"fileId"`
			FileName string `json:"fileName"`
		} `json:"attachments"`
		Signers []struct {
			PsnSigner struct {
				PsnID      string `json:"psnId"`
				PsnAccount struct {
					AccountMobile string      `json:"accountMobile"`
					AccountEmail  interface{} `json:"accountEmail"`
				} `json:"psnAccount"`
			} `json:"psnSigner"`
			OrgSigner  interface{} `json:"orgSigner"`
			SignerType int         `json:"signerType"`
			SignOrder  int         `json:"signOrder"`
			SignStatus int         `json:"signStatus"`
			SignFields []struct {
				SignFieldID           string      `json:"signFieldId"`
				SignFieldStatus       string      `json:"signFieldStatus"`
				StatusUpdateTime      int64       `json:"statusUpdateTime"`
				FailReason            interface{} `json:"failReason"`
				CustomBizNum          string      `json:"customBizNum"`
				FileID                string      `json:"fileId"`
				SignFieldType         int         `json:"signFieldType"`
				NormalSignFieldConfig struct {
					FreeMode          bool `json:"freeMode"`
					SignFieldStyle    int  `json:"signFieldStyle"`
					SignFieldPosition struct {
						PositionPage string  `json:"positionPage"`
						PositionX    float64 `json:"positionX"`
						PositionY    float64 `json:"positionY"`
					} `json:"signFieldPosition"`
					MovableSignField bool   `json:"movableSignField"`
					AutoSign         bool   `json:"autoSign"`
					SealStyle        string `json:"sealStyle"`
					SealID           string `json:"sealId"`
				} `json:"normalSignFieldConfig"`
				RemarkSignFieldConfig interface{} `json:"remarkSignFieldConfig"`
			} `json:"signFields"`
		} `json:"signers"`
		Copiers               []interface{} `json:"copiers"`
		RescissionSignFlowIds interface{}   `json:"rescissionSignFlowIds"`
	} `json:"data"`
}
